<template>
	<div id="app">
		<div id="note_post_comment">
			<textarea class="text" rows="12" id="doc-ta-1" v-model="fd.comment" placeholder="描述您对本文评论"></textarea>
			<div class="clear"></div>
			<div>
				<input type="submit" @click="submit()" class="done" value="发布"> </input>
			</div>
		</div>
	</div>

</template>

<script>
	import config from '@/config'
	export default {
		data() {
			return {
				comment1: {},
				fd: {
					comment: "",
					vid:'',
				}
			}
		},
		methods: {
			submit: function() {
				var that = this;
				uni.request({
					url: `${config.baseUrl}/article/write?token=${uni.getStorageSync('token')}`,
					method: 'POST',
					data: this.fd,
					success(r) {
						if (r.data.succ) {
							uni.navigateTo({
								url: `note_comment_list?id=${that.fd.vid}`
							})
						} else {}
					},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
				})
			},
			itemClicked1: function(item) {
				uni.navigateTo({
					url: `note_comment_list?id=${this.fd.vid}`
				})
			}
		},
		onLoad(option) {
			var that = this;
			if (option.id) {
				this.$set(this.fd, 'vid', option.id);
				// this.fd.vid = option.id;
			}
			uni.request({
				url: `${config.baseUrl}/article/one?id=${that.fd.vid}&token=${uni.getStorageSync('token')}`,
				method: "GET",
				success(r) {
					if (r.data.succ) {
						that.comment1 = r.data.data;
					} else {

					}
				},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
			})
		}
	}
</script>

<style>
</style>
